<template>
	<view class="f-page">

    <u-gap height="10"></u-gap>
    <u-loading-icon :show="loading"/>
    <u-list @scrolltolower="scrolltolower">
			<u-list-item v-for="(item, index) in quoteList" :key="index">
        <u-cell  :title="item.origin" :label="item.title" :value="item.theme" :titleStyle="style.titleStyle"
         @click="navTo('/pagework/poetry/detail?id=',item.id)"></u-cell>
		  </u-list-item>
		</u-list>
    <u-divider text="没有更多了" v-if="finished"></u-divider>
	</view>
</template>
<script>


import { fetchQuoteList } from '@/api/poetry'
export default {
	data() {
		return {
      style: {
        fontSize: 16,
        titleStyle: {'font-size': '15px','color': '#3c9cff'}
      },
      option: {},
      loading: false,
      finished: false,
      totalPage: 0,
      listQuery: {page: 1},
      theme: {},
      quoteList: []
		}
	},
  onLoad: function(option) {
    this.option = option
    this.loadmore()
  },
	methods: {
    scrolltolower() {
      if (this.listQuery.page < this.totalPage) {
        this.listQuery.page = this.listQuery.page + 1
        this.loadmore()
      }else{
        this.finished = true
      }
    },

    loadmore() {
      this.loading = true
      fetchQuoteList( {params: this.listQuery,custom: { auth: true,toast: false }}).then(response => {
        this.quoteList = this.quoteList.concat(response.data.records)
        this.totalPage = response.data.pages
        this.loading = false;
      })
    },
    navTo(url,id) {
      uni.$u.route(url, {id: id});
    }

	}

}
</script>
<style lang="scss">



</style>
